<template>
	<view>
		<view style=" width: 100%; display: flex; flex-direction: row;  " >
			<button class="btn" @click="gohome()"> 返回首页</button>
		</view>
		<view class="ryxq">
			<view class="xq-title" style="position: relative;">个人记录信息（若有改动请联系店长）</view>
			<view class="xq-list" v-for="item in data" :key="item._id" > 
			<view v-if="item.user!= undefind ">
				<view class="items">用户名：{{item.user}}</view>
				<view class="items">备注：{{item.notes}}</view>
				<view class="items">理发师：{{item.lfs}}</view>
				<view class="items">所选项目：{{item.xm}}</view>
				<view class="items">预约日期：{{item.yyrq}}</view>
				<view class="items">预约时间：{{item.yysj}}</view>
			</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return{
				data:[],
			}
		},
		onLoad(option) {
			var that = this;
			uni.showLoading({
				title: '请求数据中...'
			})
			uni.getStorage({
			    key: 'username',
			    success: function (res) {
					if(res.data){
						uniCloud.callFunction({
							name: 'record_readuser',
							data:{
								user:res.data,
							},
							success: (rest) => {
								uni.hideLoading();
								console.log(rest.result);
								let {data} = rest.result;
								that.data = data;
								console.log(data);
								uni.showToast({
									title: '请求成功',
								})
							},
							fail: (errr) => {
								console.log(errr);
							},
							complete: (cc) => {
								//console.log(cc)
							}
						})
					}else{
						uni.hideLoading();
						uni.showModal({
							title:'当前未登录请您登录',
							success: function(res){
								if (res.confirm){
									that.$util.navigateTo('../login/login');
								}
							}
						})
					}
					
			    },
				fail: (err) => {
					console.log(err);
					uni.hideLoading();
					uni.showModal({
						title:'当前未登录请您登录',
						success: function(res){
							if (res.confirm){
								that.$util.navigateTo('../login/login');
							}
						}
					})
				},
				complete: (c) => {
				}
			});

		},
		methods: {
			gohome(){
				uni.switchTab({
					url: '/pages/index/index'
				})
			}
		}
	}
</script>

<style>
	.btn{
		font-size:32rpx;
		text-align:center;
		color:white;
		background-color:#0055ff;
		height: 80rpx;
		line-height: 80rpx;
		width:200rpx;
		float: left;
	}
	page {
		background: #ffffff;
	}
	
	.ryxq {
		display: flex;
		width: 100%;
		background: #ffffff;
		flex-direction: column;
		overflow: auto;
	}
	
	.xq-list {
		flex-direction: row;
		font-size: 30upx;
		line-height: 60upx;
		flex-wrap: wrap;
		height: auto;
		border-bottom: #cccccc 2upx solid;
	}
	
	.items {
		float: left;
		overflow: hidden;
		background: #efefef;
		height: 50upx;
		line-height: 50upx;
		margin: 20upx 20upx 0upx 20upx;
		padding: 5upx 15upx 5upx 15upx;
		border-radius: 20upx;
	}
	.itemss {
		background-color:#0055ff;
		color: #ffffff;
		float: right;
		height: 50upx;
		font-size:28rpx;
		line-height: 50upx;
		margin: 20upx 40upx 0upx 20upx;
		padding: 5upx 15upx 5upx 15upx;
	}
	
	.xq-title {
		padding: 20upx;
		border-bottom: #cccccc 2upx solid;
	}
</style>
